<template>
    <div>
        <b>书籍类别</b>
        <ul>
            <li v-for="cate in categories" :key="cate.id">
                <a href="" @click.prevent="clickHandler(cate.id)">
                    {{ cate.name }}
                </a>
            </li>
        </ul>
    </div>
</template>

<script>
    export default{
        data(){
            return{
                categories:[
                    {
                        id:1,
                        name:'文学类'
                    },
                    {
                        id:2,
                        name:'经济类'
                    },
                    {
                        id:3,
                        name:'艺术类'
                    }
                ]
            }
        },
        methods:{
            clickHandler(cid){
                this.$emit("category",cid)
            }
        }
    }
</script>

<style>
</style>